package cn.jaye.fabric.infrastructure.mybatis.impl;

import cn.jaye.fabric.domain.model.User;
import cn.jaye.fabric.infrastructure.mybatis.impl.mapper.UserMapper;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.service.IService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author Jaye
 * @create 2018-06-04 14:41
 */
@Repository
public class UseRepositoryImpl extends ServiceImpl<UserMapper, User> {
    @Autowired
    private UserMapper userMapper;

    public List<User> getScoreboard() {
        return userMapper.getScoreboard();
    }

    public void updateUserPoint(String username, Integer point) {
        userMapper.updateUserPoint(username, point);
    }

    public JSONArray listScore() {
        return userMapper.listScore();
    }

    public JSONArray listMyAllGuess(String username){
        return userMapper.listMyAllGuess(username);
    }

    public Map<String, String> getMyScore(String username) {
        return userMapper.getMyScore(username);
    }

    public JSONArray listMyGuess(String username) {
        return userMapper.listMyGuess(username);
    }

    public JSONArray listScoreCountByDate(String startDate, String endDate) {
        return userMapper.listScoreCountByDate(startDate, endDate);
    }
}
